#include <algorithm>
#include <cmath>
#include <cstdio>

const int N = 1005;
int n;
double f[N][N];

struct Node {
  int x, y;
  inline bool operator<(const Node &rhs) const { return x < rhs.x; }
} a[N];

inline long long sqr(int x) { return 1ll * x * x; }

inline double getdis(int i, int j) {
  return sqrt(sqr(a[i].x - a[j].x) + sqr(a[i].y - a[j].y));
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#endif
#ifndef LOCAL
  freopen("P1523 旅行商简化版.in", "r", stdin);
  freopen("P1523 旅行商简化版.out", "w", stdout);
#endif
#endif

  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d", &a[i].x, &a[i].y);
  }
  std::sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; ++i) std::fill(f[i], f[i] + n + 2, 1e18);
  f[1][2] = getdis(1, 2);
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      f[i][j + 1] = std::min(f[i][j + 1], f[i][j] + getdis(j, j + 1));
      f[j][j + 1] = std::min(f[j][j + 1], f[i][j] + getdis(i, j + 1));
    }
  }
  double ans = 1e18;
  for (int i = 1; i < n; ++i) {
    ans = std::min(ans, f[i][n] + getdis(i, n));
  }
  printf("%.2lf", ans);
  return 0;
}